import request from "../../utils/request.ts";
import type {HospitalResponseData
    , HospitalLevelAndRegionResponseData
    , HospitalInfo} from './type'
enum API {
    //获取已有医院数据的接口地址
    HOSPITAL_URL = 'hosp/hospital/',
    //获取医院的等级与地区的接口
    HOSPITAL_LEVELANDREGION_URL = '/cmn/dict/findByDictCode/',
    //根据关键字医院的名字获取数据
    HOSPITAL_INFO_URL = '/hosp/hospital/findByHosname/'
}

export const reqHospital =
    (page: number, limit: number,hostype= '', districtCode='') =>
        request.get<any,HospitalResponseData>(API.HOSPITAL_URL + `${page}/${limit}?hostype=${hostype}&districtCode=${districtCode}`)

export const reqHospitalLevelAndRegion =
    (dictCode:string) =>
        request.get<any, HospitalLevelAndRegionResponseData>(API.HOSPITAL_LEVELANDREGION_URL+dictCode);

export const reqHospitalInfo =
    (hostName:string) =>
        request.get<any, HospitalInfo>(API.HOSPITAL_INFO_URL + hostName);
